package net.biancheng.common.utils;

import com.github.pagehelper.PageHelper;
import net.biancheng.common.core.page.PageDomain;
import net.biancheng.common.core.page.TableSupport;

/**
 * @author: lb
 * @date: 2023/8/3 16:19
 * @desc: 分页工具类
 **/
public class PageUtils extends PageHelper {

    /**
     * 设置请求分页数据
     */
    public static void startPage()
    {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Integer pageNum = pageDomain.getPageNum();
        Integer pageSize = pageDomain.getPageSize();
        Boolean reasonable = pageDomain.getReasonable();
        PageHelper.startPage(pageNum, pageSize).setReasonable(reasonable);
    }

    /**
     * 清理分页的线程变量
     */
    public static void clearPage()
    {
        PageHelper.clearPage();
    }

}
